﻿using System;
using System.Web;
using System.Web.Optimization;
using RH.Web.Utility;

namespace RH.Web
{
    public class BundleConfig
    {
        // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
        public static void RegisterBundles(BundleCollection bundles)
        {
            ///Following two lines are experimental calls
            bundles.IgnoreList.Clear();
            AddDefaultIgnorePatterns(bundles.IgnoreList);

            bundles.Add(new ScriptBundle(Bundles.jQuery).Include(
                        "~/Scripts/jquery-{version}.js"));

            //bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
            //            "~/Scripts/jquery-ui-{version}.js"));
            bundles.Add(new ScriptBundle(Bundles.jQeuryUIJS).Include(
                        "~/Scripts/jquery-ui.min.js"));

            bundles.Add(new ScriptBundle(Bundles.jQueryValidate).Include(
                //"~/Scripts/jquery.unobtrusive*",
                //"~/Scripts/jquery.validate*"));
                        "~/Scripts/jquery.validate.min.js",
                        "~/Scripts/jquery.validate.unobtrusive.min.js"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle(Bundles.Modernizer).Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle(Bundles.CommonJS)
                .Include("~/Scripts/common.js"));

            bundles.Add(new ScriptBundle(Bundles.JCroptJS)
                .Include("~/Scripts/jquery.Jcrop.min.js"));

            bundles.Add(new ScriptBundle(Bundles.JCroptJSFull)
                .Include("~/Scripts/jquery.Jcrop.js"));
            //@Html.JavaScript("jquery.Jcrop.min.js", Url)

            ///Bootstrap Configuration
            bundles.Add(new ScriptBundle(Bundles.BootstrapJS)
                .Include("~/Content/bootstrap/js/bootstrap.js"));

            bundles.Add(new ScriptBundle(Bundles.ImageGalleryJS)
                .Include("~/Scripts/jquery.blueimp-gallery.min.js",
                         "~/Scripts/bootstrap-image-gallery.js"));
        

            bundles.Add(new StyleBundle(Bundles.BootstrapCSS)
                .Include("~/Content/bootstrap/css/bootstrap.css", 
                         "~/Content/bootstrap/css/bootstrap-theme.css"));
            bundles.Add(new StyleBundle(Bundles.ImageGalleryCSS)
                .Include("~/Content/blueimp-gallery.min.css",
                         "~/Content/bootstrap-image-gallery.css"));

            
            //bundles.Add(new StyleBundle("~/Content/DesignerStyles")
            //    .Include("~/Content/DesignerStyles.css"));
                
            bundles.Add(new StyleBundle(Bundles.RHStyles)
                .Include("~/Content/RHStyles.css"));

            bundles.Add(new StyleBundle(Bundles.JCropCSS)
                .Include("~/Content/jquery.Jcrop.css"));

            //bundles.Add(new StyleBundle("~/Content/jqueryuiall")
            //    .Include("~/Content/themes/base/jquery.ui.all.css"));

            //bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
            bundles.Add(new StyleBundle(Bundles.jQueryUIDatePickerCSS)
                .Include("~/Content/themes/base/datepicker.css"));
            //bundles.Add(new StyleBundle(Bundles.jQeuryUIAllCSS).Include(
            //            //"~/Content/themes/base/jquery.ui.core.css",
            //            //"~/Content/themes/base/jquery.ui.resizable.css",
            //            //"~/Content/themes/base/jquery.ui.selectable.css",
            //            //"~/Content/themes/base/jquery.ui.accordion.css",
            //            //"~/Content/themes/base/jquery.ui.autocomplete.css",
            //            //"~/Content/themes/base/jquery.ui.button.css",
            //            //"~/Content/themes/base/jquery.ui.dialog.css",
            //            //"~/Content/themes/base/jquery.ui.slider.css",
            //            //"~/Content/themes/base/jquery.ui.tabs.css",
            //            //"~/Content/themes/base/jquery.ui.datepicker.css",
            //            //"~/Content/themes/base/jquery.ui.progressbar.css",
            //            //"~/Content/themes/base/jquery.ui.theme.css",
            //            ///New Customized jQuery UI
            //            "~/Content/themes/base/jquery-ui.css",
            //            "~/Content/themes/base/jquery-ui.min.css",
            //            "~/Content/themes/base/jquery-ui.structure.css",
            //            "~/Content/themes/base/jquery-ui.structure.min.css",
            //            "~/Content/themes/base/jquery-ui.theme.css",
            //            "~/Content/themes/base/jquery-ui.theme.min.css"));
            
        }

        #region Experimental Code

        public static void AddDefaultIgnorePatterns(IgnoreList ignoreList)
        {
            if (ignoreList == null)
                throw new ArgumentNullException("ignoreList");
            ignoreList.Ignore("*.intellisense.js");
            ignoreList.Ignore("*-vsdoc.js");
            ignoreList.Ignore("*.debug.js", OptimizationMode.WhenEnabled);
            //ignoreList.Ignore("*.min.js", OptimizationMode.WhenDisabled);
            //ignoreList.Ignore("*.min.css", OptimizationMode.WhenDisabled);
        }

        #endregion
    }
}